<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        var aList01 = [1, 2, 3, 4, 5, 6];
        // 这个方法会改变原数组
        var alist02 = aList01.reverse();

        alert(aList01);
        alert(alist02);


        var aList02 = [1, 2, 4, 5, 7, 8, 9, 5, 3, 2, 1, 3, 5, 7, 8, 6, 3, 2, 10];

        // 获取元素在数组里第一次出现的下标值
        var index = aList02.indexOf(2);
        alert(index);

        // 从后往前找
        var index1 = aList02.lastIndexOf(2);//17
        alert(index1);



        var aList03 = [1, 2, 4, 5, 6, 3, 2];

        //从下标2的位置 删除3个元素 被后面的元素替代  返回删除的元素
        var alist04 = aList03.splice(2, 3, "haha", 10, true, "hehe");//[1, 2, "haha",10,true,"hehe", 3, 2];

        alert(aList03);
        alert(alist04);
    </script>
</head>

<body>

</body>

</html>